<?php
	$idCategory=round($_GET['idCategory']);
	if(count($_POST)>0)
	{
		$name=$_POST['name'];
		$AnHien=$_POST['AnHien'];
		$sql="update `nncms_loaisp` set
		`name`='$name',
		`show_hide`='$AnHien'
		where `id`=$idCategory";
		mysqli_query($conn,$sql);
		header('location:?mod=loaisp');
	}
	$sql='select * from `category` where `id`='.$idCategory;
	$rs=mysqli_query($conn,$sql);
	$r=mysqli_fetch_assoc($rs);

?>
<form name="form1" method="post" action="">
  <table width="800" border="1" style="width:400px;margin:auto">
    <caption>
      EDIT CATEGORY
    </caption>
      <a href="?mod=category">Back to Category</a>
    <tr>
      <th width="334" scope="row">Name</th>
      <td width="450"><label>
        <input name="name" value="<?php echo $r['name']?>" type="text" id="name" size="40">
      </label></td>
    </tr>
    <tr>
      <th scope="row">Ẩn hiện</th>
      <td><label>
        <select name="AnHien" id="AnHien">
          <option <?php if($r['show_hide']==1) echo 'selected'?> value="1">Hiện</option>
          <option <?php if($r['show_hide']==0) echo 'selected'?>  value="0">Ẩn</option>
        </select>
      </label></td>
    </tr>
    <tr>
      <th scope="row">&nbsp;</th>
      <td><label>
        <input type="reset" name="reset" id="submit" value="Nhập lại">
        <input type="submit" name="submit" id="submit" value="Cập nhật">
      </label></td>
    </tr>
  </table>
</form>
